﻿@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>查询系统日志</title>
    <link rel="stylesheet" type="text/css" href="~/Content/jquery-easyui-1.4.2/themes/default/easyui.css">
    <link rel="stylesheet" type="text/css" href="~/Content/jquery-easyui-1.4.2/themes/icon.css">
    <link rel="stylesheet" type="text/css" href="~/Content/jquery-easyui-1.4.2/demo.css">
    <link href="~/Content/Styles/Manage_Order.css" rel="stylesheet" />
    <script type="text/javascript" src="~/Content/jquery-easyui-1.4.2/jquery.min.js"></script>
    <script type="text/javascript" src="~/Content/jquery-easyui-1.4.2/jquery.easyui.min.js"></script>
    <script src="~/Content/jquery-easyui-1.4.2/locale/easyui-lang-zh_CN.js"></script>

    <script>
        $(function () {
            BindLogType();
            //initTable();
            $("#chakan").linkbutton('disable');
        });

        //初始化表格  
        function initTable() {
            $('#load').datagrid({
                iconCls: 'icon-user',
                loadMsg: '数据加载中...',
                nowrap: true,
                autoRowHeight: true,
                striped: true,
                url: '/SystemLog/GetSystemLog',
                sortName: 'OperationFlowID',
                sortOrder: 'asc',
                border: true,
                remoteSort: false,
                idField: 'OperationFlowID',
                pageSize: 20,
                singleSelect: true,
                pagination: true,
                rownumbers: true,
                columns: [[
                    { field: 'OperationFlowID', title: '日志ID', width: 100, sortable: true, align: 'center', hidden: true },
					{ field: 'DictName', title: '日志类型', width: 100, sortable: true, align: 'center' },//DictName
					{ field: 'OperationTitle', title: '日志简写', width: 250, sortable: true, align: 'center' },
					{ field: 'OperationRes', title: '操作结果', width: 100, sortable: true, align: 'center' },
                    { field: 'OperationText', title: "操作解释", width: 100, align: 'center' },
                    { field: 'OperNum', title: "操作员账号", width: 100, sortable: true, align: 'center', },//OperNum
                    { field: 'OperationTime', title: "发生时间", width: 250, sortable: true, align: 'center' },
                    { field: 'OperationBZ', title: "备注", width: 150, sortable: true, align: 'center' },
                    //{ field: 'OperationYL', title: '预留字段', width: 400, sortable: true, align: 'center' }
                ]],
                toolbar: '#tb'
            });
        }

        //绑定搜索条件
        function BindLogType() {
            $('#Search_Result').combobox({
                valueField: 'id',
                textField: 'text',
                value: '-8989',
                text: '全部',
                data: [{
                    "id": "-8989",
                    "text": "全部"
                }, {
                    "id": "1",
                    "text": "成功"
                }, {
                    "id": "2",
                    "text": "失败"
                }, {
                    "id": "3",
                    "text": "异常"
                }]
            });

            $.get("/SystemLog/GetLogType", {}, function (database) {
                Search_Type
                $('#Search_Type').combobox({
                    valueField: 'DictKey',
                    textField: 'DictName',
                    value: '',
                    text:'全部',
                    data: database
                });
            })
        }

        //修改商户信息窗口
        function OpenDetail() {
            var UpdateID = $("#load").datagrid("getSelections");
            if (UpdateID.length == 1) {
                $("#DetailDialog").dialog("open").dialog("setTitle", "系统日志详细信息");
                BingDetail();
            }
            else {
                $.messager.alert("友情提示", "每次只能查看一行数据，你已经选择了<font color='red' size='6'>" + UpdateID.length + "</font>行");
            }
        }

        //获取用户信息绑定
        function BingDetail() {
            var datas = $("#load").datagrid("getSelections")[0]; //获取选中行数据
            $("#OperationTitle").textbox('setValue', datas.OperationTitle);
            $("#OperationText").textbox('setValue', datas.OperationText);
            $("#OperationType").textbox('setValue', datas.DictName);
            $("#OperationRes").textbox('setValue', datas.OperationRes);
            $("#OperationUser").textbox('setValue', datas.OperNum);
            $("#OperationTime").textbox('setValue', datas.OperationTime);
            $("#OperationBZ").textbox('setValue', datas.OperationBZ);
            $("#OperationYL").textbox('setValue', datas.OperationYL);
        }

        //搜索
        function Search() {
            var time_start = $('#Search_Time_Start').datebox('getValue');
            var time_end = $('#Search_Time_End').datebox('getValue');
            var logtype = $('#Search_Type').combobox('getValue');
            var operat_result = $('#Search_Result').combobox('getValue');
            $("#chakan").linkbutton('enable');
            $('#load').datagrid({
                iconCls: 'icon-user',
                loadMsg: '数据加载中...',
                nowrap: true,
                autoRowHeight: true,
                striped: true,
                url: '/SystemLog/GetSystemLog?Time_Start=' + time_start + "&Time_End=" + time_end + "&LogType=" + logtype + "&Operat_Result=" + operat_result,
                sortName: 'OperationFlowID',
                sortOrder: 'asc',
                border: true,
                remoteSort: false,
                idField: 'OperationFlowID',
                pageSize: 20,
                singleSelect: true,
                pagination: true,
                rownumbers: true,
                columns: [[
                    { field: 'OperationFlowID', title: '日志ID', width: 100, sortable: true, align: 'center', hidden: true },
					{ field: 'DictName', title: '日志类型', width: 100, sortable: true, align: 'center' },//DictName
					{ field: 'OperationTitle', title: '日志简写', width: 250, sortable: true, align: 'center' },
					{ field: 'OperationRes', title: '操作结果', width: 100, sortable: true, align: 'center' },
                    { field: 'OperationText', title: "操作解释", width: 100, align: 'center' },
                    { field: 'OperNum', title: "操作员账号", width: 100, sortable: true, align: 'center', },//OperNum
                    { field: 'OperationTime', title: "发生时间", width: 250, sortable: true, align: 'center' },
                    { field: 'OperationBZ', title: "备注", width: 150, sortable: true, align: 'center' },
                    //{ field: 'OperationYL', title: '预留字段', width: 400, sortable: true, align: 'center' }
                ]],
                toolbar: '#tb'
            });

        }
    </script>

</head>
<body style="padding: 0;">
    <!--表格加载S-->
    <div>
        <table id="load" style="width: auto;"></table>
    </div>
    <!--表格加载E-->

    <!--工具栏S-->
    <div id="tb" style="padding: 5px; height: auto; width: 100%;">
        <div style="margin-bottom: 5px">
            <a id="chakan" href="#" class="easyui-linkbutton" iconcls="icon-edit" onclick="OpenDetail()">查看详细</a>
            <hr style="margin-top: 5px" />
            &nbsp;&nbsp;
            查询条件：&nbsp;
            时间：&nbsp;<input id="Search_Time_Start" class="easyui-datebox" style="width: 100px" />&nbsp;至&nbsp;<input id="Search_Time_End" class="easyui-datebox" style="width: 100px" />&nbsp;
            日志类型：&nbsp;<input id="Search_Type" class="easyui-combobox" />&nbsp;
            操作结果：&nbsp;<input id="Search_Result" class="easyui-combobox" />&nbsp;
            <a href="#" class="easyui-linkbutton" onclick="Search()" iconcls="icon-search">查询</a>
        </div>
    </div>
    <!--工具栏E-->

    <!--修改S-->
    <div id="DetailDialog" class="easyui-dialog" style="width: 550px; padding: 10px 0" closed="true" resizable="true" modal="true" buttons="#dlg-buttons" align="center">
        <ul style="margin-bottom: 30px;">
            <li class="info-li" style="margin-top: 10px">
                <div class="info-li-first fl">日志简写：</div>
                <div class="info-li-second fl">
                    <input id="OperationTitle" class="easyui-textbox" style="width: 90%; height: 30px" data-options="required:true">
                </div>
            </li>
            <li class="info-li">
                <div class="info-li-first fl">操作解释：</div>
                <div class="info-li-second fl">
                    <input id="OperationText" class="easyui-textbox" style="width: 90%; height: 30px" data-options="required:true">
                </div>
            </li>
            <li class="info-li">
                <div class="info-li-first fl">日志类型：</div>
                <div class="info-li-second fl">
                    <input id="OperationType" class="easyui-textbox" style="width: 90%; height: 30px" data-options="required:true">
                </div>
            </li>
            <li class="info-li">
                <div class="info-li-first fl">操作结果：</div>
                <div class="info-li-second fl">
                    <input id="OperationRes" class="easyui-textbox" style="width: 90%; height: 30px" data-options="required:true">
                </div>
            </li>
            <li class="info-li">
                <div class="info-li-first fl">操作员账号：</div>
                <div class="info-li-second fl">
                    <input id="OperationUser" class="easyui-textbox" style="width: 90%; height: 30px" data-options="required:true">
                </div>
            </li>
            <li class="info-li">
                <div class="info-li-first fl">发生时间：</div>
                <div class="info-li-second fl">
                    <input id="OperationTime" class="easyui-textbox" style="width: 90%; height: 30px" data-options="required:true" />
                </div>
            </li>
            <li class="info-li">
                <div class="info-li-first fl">备注：</div>
                <div class="info-li-second fl">
                    <input id="OperationBZ" class="easyui-textbox" style="width: 90%; height: 30px">
                </div>
            </li>
            <li class="info-li">
                <div class="info-li-first fl">预留：</div>
                <div class="info-li-second fl">
                    <input id="OperationYL" class="easyui-textbox" style="width: 90%; height: 30px">
                </div>
            </li>
            <li class="info-li">
                <div class="info-li-first fl">&nbsp;</div>
                <div class="info-li-second fl">
                    <a id="btnUpdateCancel" href="javascript:(0)" onclick="javascript:$('#DetailDialog').dialog('close')" class="easyui-linkbutton" data-options="iconCls:'icon-cancel'">取消</a>
                </div>
            </li>
        </ul>
    </div>
    <!--修改E-->

</body>
</html>
